//
//  MagneticEffect.m
//  StarBugs
//
//  Created by ?? ? on 3/20/12.
//  Copyright 2012 antisword@playorca.com. All rights reserved.
//

#include "Sprite/MagneticEffect.h"
#include "Util/ImageManager.h"

using namespace cocos2d;

MagneticEffect::MagneticEffect()
{
    mainSprite = ImageManager::getSpriteWithXml2(kImagesheet_GameSource, "spark1");
    mainSprite->setPosition(ccp(0 ,0));
    addChild(mainSprite);
    
    frame[0] = ImageManager::getFrameWithXml2(kImagesheet_GameSource, "spark1");
    frame[1] = ImageManager::getFrameWithXml2(kImagesheet_GameSource, "spark2");
    frame[2] = ImageManager::getFrameWithXml2(kImagesheet_GameSource, "spark3");
    
    cnt = 0;
    schedule(schedule_selector(MagneticEffect::tick), 0.1);
}

void MagneticEffect::tick(float dt)
{
    cnt = (cnt + 1) % 3;
    mainSprite->setDisplayFrame(frame[cnt]);
}
